//
//  WOTextnSection.m
//  WOPrototype
//
//  Created by Olof Millberg on 2010-04-27.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "WOTextSection.h"


@implementation WOTextSection
@synthesize text;

+ (id) textSectionWithTitle:(NSString *)aTitle text:(NSString *)aText
{
	WOTextSection *section = [[[WOTextSection alloc] initWithTitle:aTitle text:aText] autorelease];
	return section;
}

- (id) initWithTitle:(NSString *)aTitle text:(NSString *)aText
{
	if (self = [super init])
	{
		self.title = aTitle;
		self.text = aText;
	}
	return self;
}

- (void) dealloc
{
	[text release];
	[super dealloc];
}

- (NSInteger) numberOfRows
{
	return 1;
}

- (NSString *)identifierAtRow:(NSInteger)row
{
	return @"TextCell";
}
					   
- (CGFloat) heightForRow:(NSInteger)row
{
	return MAX(32, [self.text sizeWithFont:[UIFont systemFontOfSize:15.0f]
			constrainedToSize:CGSizeMake(280.f, 120.f)
				lineBreakMode:UILineBreakModeWordWrap].height + 16);
}

@end
